#include"process.h"
#define TIME 1
double speed[5]={1000,3000,7000,15000,290000};
typedef void (*call_t)(const char*tips,double total,double current);
void Download(const char*tips,double total,call_t cd)
{
    
    srand(time(NULL));
    double current=0;
    while(current<=total)
    {
        usleep(TIME);
        cd(tips,total,current);
        if(current>=total)
            break;
        int random=rand()%5;
        current+=speed[random]*TIME/1000000;
        if(current>total)
            current=total;
    }
    printf("\n");
}

int main()
{
    Download("下载中",1024,Flushprocess);
    return 0;
}
